function add(x,y) {
  // 直接接收两个参数, 然后返回即可. 
  return x + y
}


function currying(x) {
  // 里面是一个匿名函数, 接收第二个参数
  return function (y) {
    return x + y
  }
}


function curryingV2(x){
  return function(){
    let args = [...arguments]
    let sum;
    args.map(x => {sum += Number(x)})
    console.log(sum);
  }
}
curryingV2(1)(2,3,4,5,6)

// console.log(add(1, 2));
// console.log(currying(1)(2));



console.log(typeof NaN );
console.log(typeof 0 );

let arr = ['1', '2', '3']
console.log(arr.map(parseInt));

console.log(parseInt('1'));
console.log(parseInt('2'));
console.log(parseInt('3'));
console.log(parseInt('4'));
console.log(parseInt('5'));
const result = arr.map(item => parseInt(item))
const res = arr.map(parseInt)
console.log(res);
console.log(result);





function curryingV3(x) {
  return function(y) {
   return function(z) {
     return x + y + z
   }
  }
}

curryingV3(1)(2)(3)


// 这里执行, 还得看后面的内容, 如果后面还有, 这里还会往后推. 
for(var i=0;i<=3;i++){
	setTimeout(()=>{
		console.log(i)
	}, 0)
}

for(let i=0;i<=3;i++){
	setTimeout(()=>{
		console.log(i)
	}, 0)
}

// null -> object typeof
// undefined -> undefined typeof
// number -> number    typeof
// string -> string typeof
// array ->  object typeof  
// obj {} -> object typeof  
// function -> function typeof

console.log(typeof [1, 2, 3]);
console.log(typeof {name:'kobe'});